{{template "header.html" .}}
<link rel="stylesheet" href="/assets/js/plugins/pagination/pagination.css" />
<link href="/assets/css/plugins/sweetalert/sweetalert.css" rel="stylesheet">
<body class="gray-bg">
<div class="wrapper wrapper-content  animated fadeInRight">
    <div class="row">
        <div class="col-sm-12">
            <div class="ibox">
                <div class="ibox-content">
                    <h3><a href="/project">项目列表 </a> /项目环境(当前项目：{{.project.Proname}} )</h3>
                    <p>
                        <button type="button" class="btn btn-outline btn-default" data-toggle="modal" data-target="#myModal">
                            <i class="glyphicon glyphicon-plus" aria-hidden="true"></i>
                        </button>
                        请为项目创建应用环境（如：测试环境、集成环境、仿真环境、线上环境……）
                    </p>
                    <div class="clients-list">
                        <ul class="nav nav-tabs"> <span class="pull-right small text-muted totalCount"></span>

                        </ul>
                        <div class="tab-content">
                            <div class="table-responsive">
                                <table class="table table-striped table-hover" style="margin-bottom: 0px;">
                                    <thead>
                                    <tr>
                                        <th>环境名称</th>
                                        <th>环境域名</th>
                                        <th>排序(数字越小，环境等级越高)</th>
                                        <th>是否启动</th>
                                        <th>修改</th>
                                    </tr>
                                    </thead>
                                    <tbody>
                                        {{range .env}}
                                            <tr>
                                                <td>{{.Envname}}</td>
                                                <td>{{.Domain}}</td>
                                                <td>{{.Sort}}</td>
                                                <td>
                                                    <label class="i-switch m-t-xs m-r">
                                                        <input type="checkbox" name="isopen" class="envopen"  proid="{{.Proid}}" envid="{{.Id}}" {{if eq .Status 1}} checked {{end}}>
                                                        <i></i>
                                                    </label>
                                                </td>
                                                <td>
                                                    <a data-toggle="modal" data-target="#myModal" envid="{{.Id}}" envname="{{.Envname}}" domain="{{.Domain}}"  sort="{{.Sort}}" status="{{.Status}}">
                                                        修改
                                                    </a>
                                                </td>
                                            </tr>
                                        {{end}}
                                    </tbody>
                                </table>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<div class="modal inmodal" id="myModal" tabindex="-1" role="dialog" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content animated bounceInRight">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">×</span><span class="sr-only">关闭</span>
                </button>
                <h4 class="modal-title">添加项目环境</h4>
                </div>
            <small class="font-bold">
                <div class="ibox-content">
                    <form id="envFrom" type="post" class="form-horizontal">
                        <div class="form-group">
                            <label class="col-sm-3 control-label">环境名称：</label>
                            <div class="col-sm-8">
                                <input type="text" name="envname" class="form-control" placeholder="线上环境">
                                <span class="help-block m-b-none text-danger"></span>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">环境域名：</label>
                            <div class="col-sm-8">
                                <input type="text" name="domain" class="form-control" placeholder="http://api.smaty.net">
                                <span class="help-block m-b-none text-danger"></span>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">排序：</label>

                            <div class="col-sm-8">
                                <input type="text" name="sort" class="form-control" placeholder="0">
                                <span class="help-block m-b-none text-danger"></span>
                                <label class="help-block m-b-none ">数字越小，环境等级越高，线上环境请设置为0</label>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">是否开启：</label>

                            <div class="col-sm-8">
                                <label class="i-switch m-t-xs m-r">
                                    <input type="checkbox" name="isopen" class="i-switch-isopen" checked >
                                    <i></i>
                                </label>
                            </div>
                        </div>
                        <div class="form-group">
                            <div class="col-sm-offset-3 col-sm-8">
                                <input type="hidden" name="envid" value="0">
                                <button type="submit" class="btn btn-w-m btn-info btn-info-submit" proid="{{.proid}}">提 交</button>
                            </div>
                        </div>
                    </form>
                </div>
            </small></div>
        <small class="font-bold">
        </small></div>
    <small class="font-bold">
    </small>
</div>
</body>
<script src="/assets/js/plugins/pagination/jquery.pagination.min.js"></script>
<script src="/assets/js/plugins/sweetalert/sweetalert.min.js"></script>
<script src="/assets/js/plugins/validate/jquery.validate.min.js"></script>
<script src="/assets/js/plugins/validate/messages_zh.min.js"></script>
<script src="/assets/js/bootstrap.min.js?v=3.3.6"></script>
<script src="/assets/js/content.js?v=4.1.0"></script>
<script src="/assets/js/project.js"></script>
<script>
    //环境开关
    $('.envopen').attr('disabled',"true");
</script>